
import 'package:flutter_screenutil/screenutil.dart';
import 'package:flutter_swiper/flutter_swiper.dart';
import 'package:flutter/material.dart';
import 'package:flutterroom/pages/home/widgets/common_image.dart';


const List<String> defautImages = [
  'http://ww3.sinaimg.cn/large/006y8mN6ly1g6e2tdgve1j30ku0bsn75.jpg',
  'http://ww3.sinaimg.cn/large/006y8mN6ly1g6e2whp87sj30ku0bstec.jpg',
  'http://ww3.sinaimg.cn/large/006y8mN6ly1g6e2tl1v3bj30ku0bs77z.jpg',
];


class CommonSwiper extends StatelessWidget {

  final List<String> images;
  const CommonSwiper({Key key, this.images =defautImages}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    //屏幕的宽度
    return Container(
      height: ScreenUtil().setHeight(350),
      child: Swiper(
        itemCount: images.length,
        itemBuilder: (BuildContext context,int index){
          return new CommonImage(
            images[index],
            fit: BoxFit.fill,
          );
        },
        pagination: new SwiperPagination(),
        autoplay: true,
      ),
    );
  }
}